package com.asset.admin.controller;

import com.asset.admin.biz.ILoginBiz;
import com.asset.common.result.ResultMsg;
import com.asset.common.utils.encrypt.EncryptUtil;
import com.asset.user.dao.entity.UserEntity;
import com.asset.user.form.UserForm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 登录controller
 * </p>
 *
 * @author 牧之
 * @date 2024/2/20 11:13
 */
@RestController
@RequestMapping("/login")
@Slf4j
public class LoginController {

    @Resource
    private ILoginBiz loginBiz;

    public ResultMsg<Object> register(@RequestBody UserForm userForm){
        return loginBiz.register(userForm);
    }

    //账户密码登录/注册
    @ResponseBody
    @PostMapping("/login")
    public ResultMsg<Object> login(@RequestBody UserForm userForm, HttpServletResponse response){
        return loginBiz.login(userForm,response);
    }


    //微信扫码登录
    //后面再做   由简入繁
    public void loginByWx(){

    }

    public void logOut(){

    }
}
